<?php
// +----------------------------------------------------------------------
// | OpenCMF [ Simple Efficient Excellent ]
// +----------------------------------------------------------------------
// | Copyright (c) 2014 http://www.lingyun.net All rights reserved.
// +----------------------------------------------------------------------
// | Author: jry <598821125@qq.com>
// +----------------------------------------------------------------------
namespace Yiban\Controller;

use     Common\Util\Think\Page;
use Home\Controller\HomeController;

/**
 * 默认控制器
 * @author jry <598821125@qq.com>
 */
class ProblemController extends HomeController
{

    /**
     * 用户列表
     * @author jry <598821125@qq.com>
     */
    public function a()
    {
        if (IS_POST) {
            $user_object = D('Yiban/Problem');
            $data = $user_object->create();
            if ($data) {
                $id = $user_object->add();
                if ($id) {
                    $this->success('新增成功', U('index'));
                } else {
                    $this->error('新增失败');
                }
            } else {
                $this->error($user_object->getError());
            }
        } else {
            // 使用FormBuilder快速建立表单页面。
            $builder = new \Common\Builder\FormBuilder();
            $builder->setMetaTitle('新增')//设置页面标题
            ->setPostUrl(U('add'))//设置表单提交地址
            ->addFormItem('xuehao', 'text', '学号', '学号')
                ->addFormItem('nownum', 'text', '现用号码', '现用号码')
                ->addFormItem('num','text', '以前号码','以前号码')
                ->addFormItem('miaoshu','text', '排序','描述')
                ->display();
        }
    }

}
